﻿using System;
using Unity.VisualScripting;

namespace Pisces
{
	/// <summary>
	/// 
	/// created by wangqiang
	/// </summary>
	public class ByteBuffer
	{
		private byte[] buffer;
		
		private int capacity;

		private int offset;

		public int Capacity
		{
			get => capacity;
			set => capacity = value;
		}

		public int Offset
		{
			get => offset;
			set => offset = value;
		}
		
		public ByteBuffer(int capacity)
		{
			this.capacity = capacity;
			this.offset = 0;
			buffer = new byte[capacity];
		}

		public void clear()
		{
			Array.Clear(buffer, 0, capacity);
			offset = 0;
		}

		public byte[] getBuffer()
		{
			return buffer;
		}
		
		public int getLength()
		{
			return buffer.Length;
		}
	}
}